<div class="page_title">
    <span class="title_icon"><span class="blocks_images"></span></span>
    <h3>compras de  medicamentos</h3>    
</div>
<div id="content">
    <div class="grid_container">
        <div class="grid_8">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon blocks_images"></span>
                    <h6>compra de:  <?php echo $nombre; ?></h6>
                </div>
                <div class="widget_content">                    
                    <table class="display data_tbl">
                        <thead>
                            <tr>                                                               
                                <th>Cantidad</th>
                                <th>PrecioU.</th>                               
                                <th>Expiracion</th>
                                <th>StockM.</th>
                                <th>LineaLab.</th>
                                <th>Acciones</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $i = 1;
                            foreach ($compras as $p):
                                ?>
                                <tr class="gradeA">

                                    <!-- <td><?php echo $i;?> </td> -->
                                    <td><?php echo h($p['Comprasmedicamento']['cantidad']); ?></td>
                                    <td><?php echo h($p['Comprasmedicamento']['preciocompra']); ?></td>
                                    <td><?php echo h($p['Comprasmedicamento']['fechavencimiento']); ?></td>
                                    <td><?php echo h($p['Comprasmedicamento']['stockminimo']); ?></td>
                                    <td><?php echo h($p['Lineaslaboratorio']['nombre']); ?></td> 
                                    <td>
                                     <?php echo $this->Ajax->link('EDITAR', array('action' => 'ajaxeditarcompra', $p['Comprasmedicamento']['id'] ), array( 'update' => 'cargaedit', 'title' => 'Edicion de datos', 'escape' => false));?>
                                        &nbsp;
                                        
                                        <?php echo $this->Html->link('ELIMINAR', array('action' => 'deletecompra', $p['Comprasmedicamento']['id'], $p['Comprasmedicamento']['medicamento_id']), null, 'esta seguro de eliminar el precios item # ' . $i . '?') ?>
                                    </td> 
                                </tr>                           
                                <?php
                                $i++;
                            endforeach;
                            ?>
                        </tbody>
                         
                    </table>
                </div>
            </div>
        </div>
        <div class="grid_4">
        <div  id="cargaedit">
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon list"></span>
                    <h6>medicamento a comprar: <?php echo $nombre; ?></h6>
                </div>
                <div class="widget_content">                    
                    <?php echo $this->Form->create('Medicamento', array('action'=>'comprass','id' => 'regitstraion_form', 'class' => 'form_container left_label')); ?>
                    <?php echo $this->form->hidden('Comprasmedicamento.medicamento_id', array('value'=>$id)) ?>
                    <ul>
                        <li>
                                <div class="form_grid_12">
                                    <label class="field_title" for="username">Linea laboratorio<span class="req">*</span></label>
                                    <div class="form_input">
                                        <select data-placeholder="Seleccione una linea..." class="chzn-select full" name="data[Comprasmedicamento][lineaslaboratorio_id]" tabindex="4" id="cb_dpto">
                                            <option value=""></option>
                                            <?php foreach ($lineaslaboratorios as $l): ?>
                                                <option value="<?php echo $l['Lineaslaboratorio']['id'] ?>">
                                                    <?php echo $l['Lineaslaboratorio']['nombre'] ?>
                                                </option>
                                            <?php endforeach; ?>
                                        </select>
                                    </div>
                                </div>
                            </li> 
                        
                        <li>
                            <div class="form_grid_12">
                                <label class="field_title" for="password">Cantidad <span class="req">*</span></label>
                                <div class="form_input">
                                    <?php echo $this->Form->text('Comprasmedicamento.cantidad', array('tabindex' => 1, 'class' => 'required mid')); ?>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form_grid_12">
                                <label class="field_title" for="password">Precio compra unitario <span class="req">*</span></label>
                                <div class="form_input">                                
                                    <?php echo $this->Form->text('Comprasmedicamento.preciocompra', array('tabindex' => 1, 'class' => 'required mid')); ?>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form_grid_12">
                                <label class="field_title" for="password">Fecha compra <span class="req">*</span></label>
                                <div class="form_input">
                                    <?php echo $this->Form->text('Comprasmedicamento.fechacompra', array('tabindex' => 1, 'class' => 'required mid')); ?>
                                </div>
                            </div>
                        </li>                        
                        <li>
                            <div class="form_grid_12">
                                <label class="field_title" for="password">Fecha expiracion <span class="req">*</span></label>
                                <div class="form_input">
                                    <?php echo $this->Form->text('Comprasmedicamento.fechavencimiento', array('tabindex' => 1, 'class' => 'required mid')); ?>
                                </div>
                            </div>
                        </li>

                        <li>
                            <div class="form_grid_12">
                                <label class="field_title" for="password">Stock minimo <span class="req">*</span></label>
                                <div class="form_input">
                                    <?php echo $this->Form->text('Comprasmedicamento.stockminimo', array('tabindex' => 1, 'class' => 'required mid')); ?>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form_grid_12">
                                <div class="form_input">
                                    <button type="submit" class="btn_small btn_blue"><span>Registrar Compra</span></button>
                                    <button type="reset" class="btn_small btn_blue"><span>Limpiar datos</span></button>
                                </div>
                            </div>
                        </li>
                    </ul>
                    </form>
                </div>
            </div>
        </div>
       </div>
    </div>
</div>
<?php //echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $trauma['Trauma']['id']), null, __('Are you sure you want to delete # %s?', $trauma['Trauma']['id']));  ?>
                

